package com.weijianhuawen.wjblog.web.controller;

import com.weijianhuawen.wjblog.common.aspect.ApiOperationLog;
import com.weijianhuawen.wjblog.common.utils.Response;
import com.weijianhuawen.wjblog.web.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-12-12 0:41
 */

@RestController
@RequestMapping("/file")
@Api(tags = "前台文件模块")
public class FileController {
    @Autowired
    private FileService fileService;
    // 文件上传
    @PostMapping("/upload")
    @ApiOperation(value = "上传文件")
    @ApiOperationLog(description = "前台上传文件")
    public Response upload(@RequestParam MultipartFile file) {
        return fileService.uploadFile(file);
    }
}
